package com.example.property.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.property.databinding.ItemColorBinding
import com.example.property.entity.CarColorValues

class CarColorAdapter constructor(private val layoutId: Int) : BaseQuickAdapter<CarColorValues, CarColorAdapter.ItemViewHolder>(layoutId){
    inner class ItemViewHolder(val binding: ItemColorBinding): BaseViewHolder(binding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
        var itemBinding = DataBindingUtil.inflate<ItemColorBinding>(LayoutInflater.from(parent.context), layoutId, parent, false)
        return ItemViewHolder(itemBinding)
    }

    override fun convert(holder: ItemViewHolder, item: CarColorValues) {
        holder.binding.entity = item
        holder.binding.executePendingBindings()
    }


}